/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.objects;

import android.graphics.Color;

/**
 * <p>
 * This class represents the text input resource that is a heavyweight control that accepts a text entry from the user.
 * Depending on the platform on which the receiver runs, the text input resource may appear different visually from one
 * receiver to another. It is a simple JavaBean (POJO) that provides getters and setters for all private attributes and
 * performs no argument validation in the setters.
 * </p>
 * <p>
 * <strong>Thread safety:</strong> This class is mutable and not thread safe.
 * </p>
 *
 * @author saarixx, jmn
 * @version 1.0
 */
public class XRETextInput extends XREResource {
    /** Represents default text input's text size. */
    private static final int DEFAULT_TEXT_SIZE = 12;

    /**
     * <p>
     * The text displayed in the control. Defaults to an empty string.
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private String text = "";

    /**
     * <p>
     * The value that indicates whether the text should be masked for password fields.
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private boolean maskText;

    /**
     * <p>
     * The font resource to be used to display the text.
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private XREFont font;

    /**
     * <p>
     * The color used to draw the text.
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private int color = Color.BLACK;

    /**
     * <p>
     * The text size, in pixels.
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     * <p>
     * AndroidAssembly1 added default text size value
     */
    private int size = DEFAULT_TEXT_SIZE;

    /**
     * <p>
     * Creates new instance of {@link XRETextInput} class.
     * </p>
     */
    public XRETextInput() {
        // empty constructor
    }

    /**
     * <p>
     * Retrieves the text displayed in the control.
     * </p>
     *
     * @return the text displayed in the control
     */
    public String getText() {
        return text;
    }

    /**
     * <p>
     * Sets the text displayed in the control.
     * </p>
     *
     * @param text the text displayed in the control
     */
    public void setText(String text) {
        this.text = text;
    }

    /**
     * <p>
     * Retrieves the value that indicates whether the text should be masked for password fields.
     * </p>
     *
     * @return the value that indicates whether the text should be masked for password fields
     */
    public boolean isMaskText() {
        return maskText;
    }

    /**
     * <p>
     * Sets the value that indicates whether the text should be masked for password fields.
     * </p>
     *
     * @param maskText the value that indicates whether the text should be masked for password fields
     */
    public void setMaskText(boolean maskText) {
        this.maskText = maskText;
    }

    /**
     * <p>
     * Retrieves the font resource to be used to display the text.
     * </p>
     *
     * @return the font resource to be used to display the text
     */
    public XREFont getFont() {
        return font;
    }

    /**
     * <p>
     * Sets the font resource to be used to display the text.
     * </p>
     *
     * @param font the font resource to be used to display the text
     */
    public void setFont(XREFont font) {
        this.font = font;
    }

    /**
     * <p>
     * Retrieves the color used to draw the text.
     * </p>
     *
     * @return the color used to draw the text
     */
    public int getColor() {
        return color;
    }

    /**
     * <p>
     * Sets the color used to draw the text.
     * </p>
     *
     * @param color the color used to draw the text
     */
    public void setColor(int color) {
        this.color = color;
    }

    /**
     * <p>
     * Retrieves the text size, in pixels.
     * </p>
     *
     * @return the text size, in pixels
     */
    public int getSize() {
        return size;
    }

    /**
     * <p>
     * Sets the text size, in pixels.
     * </p>
     *
     * @param size the text size, in pixels
     */
    public void setSize(int size) {
        this.size = size;
    }
}
